#ifndef H_EQUIPCOM
#define H_EQUIPCOM
#include "precompiled.h"
#include "item.h"
#include "enchant.h"
namespace weo
{
    namespace engine
    {
        namespace character
        {
            class Equipcom
            {
            private:
                typedef boost::array<float,weo::engine::item::KeyValuesLength> statarray;
                statarray m_Base;
                statarray m_Buff;
                statarray m_Equip;
                statarray m_Combined;
                statarray m_Test;
                unsigned int m_Mode;
                google::sparse_hash_set<float> m_SpecialsBase;
                google::sparse_hash_set<float> m_SpecialsBuff;
                google::sparse_hash_set<float> m_SpecialsEquip;
                google::sparse_hash_set<float> m_SpecialsTest;
                static bool s_IsInitialized;
                static bool s_UseSpecial;
                const weo::engine::item::ItemPtr* m_Items;
                const weo::engine::item::GemPtr* m_Gems;
                const weo::engine::item::EnchantPtr* m_Enchants;
                static bool s_UseWeaponProcs;
                static std::map<unsigned int const,weo::engine::item::Attribute> s_SpecialMap;
                void LoadSpecialValuesFromXml();
                bool m_HasExecutioner;
            public:
                Equipcom();
                void ResetBase() {std::fill(m_Base.begin(),m_Base.end(),0.0f);m_SpecialsBase.clear();};
                void ResetBuffs() {std::fill(m_Buff.begin(),m_Buff.end(),0.0f);m_SpecialsBuff.clear();};
                void ResetEquip() {std::fill(m_Equip.begin(),m_Equip.end(),0.0f);m_SpecialsEquip.clear(); m_HasExecutioner = false;};
                void ResetTest() {std::fill(m_Test.begin(),m_Test.end(),0.0f);m_SpecialsTest.clear();};
                unsigned int Mode() const {return m_Mode;};
                void Mode(const unsigned int value) {m_Mode = value;};
                float Get(const unsigned int key) const;
                void Set(const unsigned int key, const float value);
                float& operator[](const unsigned int index);
                unsigned int Size() const {return weo::engine::item::KeyValuesLength;};
                weo::engine::item::Attribute handleSpecial(unsigned int value);
                bool hasSpecial(float value);
                void setItems(const weo::engine::item::ItemPtr* items) {m_Items = items;};
                void setGems(const weo::engine::item::GemPtr* gems) {m_Gems = gems;};
                void setEnchants(const weo::engine::item::EnchantPtr* enchants) {m_Enchants = enchants;};
                const weo::engine::item::Item* getItem(const unsigned int slot) const {if(m_Items!= NULL) {return m_Items[slot];} return NULL;};
                const weo::engine::item::Item* getGem(const unsigned int slot, const unsigned int number ) const {if(m_Gems!= NULL) {return m_Gems[slot];} return NULL;};
                static void UseSpecial(bool value) {s_UseSpecial = value;};
                static void UseWeaponProcs(bool value) {s_UseWeaponProcs = value;};
            };
        };
    };
};
#endif
